package zisu.netty.practice.RPC.client.proxy;

import zisu.netty.practice.RPC.demo.invoke.HelloService;
import zisu.netty.practice.RPC.demo.invoke.HelloServiceImpl;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Desc: ""
 * @Author: caixiang
 * @DATE: 2021/1/28 10:28
 */
public class HelloServiceProxy implements InvocationHandler {
    private final HelloService helloService;

    public HelloServiceProxy(HelloService helloService){
        this.helloService = helloService;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("---------before-------");
        Object invoke = method.invoke(helloService, args);
        System.out.println("---------after-------");

        return invoke;
    }
}
